package com.boot.sample.mybatis.mapper;

import com.boot.sample.mybatis.domain.PrivateLetter;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PrivateLetterMapper {
    @Select("SELECT * FROM private_letter_0 WHERE from_uid = #{uid}")
    List<PrivateLetter> findBySendUid(@Param("uid") Long uid);

    @Select("\t\tinsert into private_letter_0\n" +
            "\t\t(from_uid,to_uid,content,send_time)\n" +
            "        values\n" +
            "\t\t(#{letter.from_uid},#{letter.to_uid},#{letter.content},#{letter.time})")
    void save(@Param("letter") PrivateLetter user);
}
